function loadRequestTest(){
    data = [{
        request: 'test_savePlayer',
        input: [],
        buttonName: '保存角色'
    }, {
        request: 'getPlayerInfo',
        input: [],
        buttonName: '获取角色信息'
    }, {
        request: 'getBagInfo',
        input: [],
        buttonName: '获取背包信息'
    }, {
        request: 'addItem',
        input: ['itemId', 'num'],
        buttonName: '添加物品到背包'
    }, {
        request: 'addMoney',
        input: ['num'],
        buttonName: '添加金钱'
    },  {
        request: 'test_addGold',
        input: ['num'],
        buttonName: '添加金币'
    },{
        request: 'test_getEquipmentInfo',
        input: [],
        buttonName: '获取装备信息'
    }, {
        request: 'getPropName',
        input: [],
        buttonName: '获取物品id对应名字信息'
    }, {
        request: 'test_attackMonster',
        input: [],
        buttonName: '测试_攻击怪物'
    }, {
        request: 'test_attackCaveMonster',
        input: ['monsterId'],
        buttonName: '测试_攻击副本怪物'
    }, {
        request: 'test_getEquipment',
        input: ['type', 'lvl', 'flag', 'secretMapId', 'lucky'],
        buttonName: '测试_获得装备'
    }, {
        request: 'test_getAdventureBag',
        input: [],
        buttonName: '获得冒险背包信息'
    }, {
        request: 'test_setLattice',
        input: ['latticeId'],
        buttonName: '设置lattice'
    }, {
        request: 'test_trialBattle',
        input: [],
        buttonName: '开始试炼'
    }, {
        request: 'joinTrial',
        input: [],
        buttonName: '参加试炼'
    }, {
        request: 'test_sendMail',
        input: ['playerId', 'title', 'content', 'itemId', 'menoy', 'gold'],
        buttonName: '发送邮件'
    }, {
        request: 'getMails',
        input: [],
        buttonName: '获取邮件'
    }, {
        request: 'addItemABag',
        input: ['itemId'],
        buttonName: '添加物品到冒险背包'
    }, {
        request: 'test_getFieldBossInfo',
        input: ['guardSceneId'],
        buttonName: '获取守护之地boss信息'
    }, {
        request: 'test_enterGuard',
        input: ['guardSceneId'],
        buttonName: '进入守护之地'
    }, {
        request: 'test_attackFieldBoss',
        input: ['guardSceneId'],
        buttonName: '攻击守护之地boss'
    }, {
        request: 'test_lvlup',
        input: [],
        buttonName: '测试_提升等级'
    }, {
        request: 'test_lvldown',
        input: [],
        buttonName: '测试_降低等级'
    }, {
        request: 'test_getTemplateConfig',
        input: [],
        buttonName: '测试_获取模板信息'
    }, {
        request: 'test_deleteUser',
        input: [],
        buttonName: '测试_删除所有用户'
    }, {
        request: 'test_latticeData',
        input: ['secretMapId'],
        buttonName: '测试_格子数据'
    }, {
        request: 'extractMail',
        input: ['mailId'],
        buttonName: '测试_提取邮件物品'
    }, {
        request: 'sellToTrade',
        input: ['pos', 'sellGold', 'num'],
        buttonName: '出售物品到交易所'
    }, {
        request: 'getTradeInfo',
        input: ['sellType', 'page'],
        buttonName: '获取交易所信息'
    }, {
        request: 'bugTrade',
        input: ['tradeId'],
        buttonName: '购买物品'
    },{
      request: 'test_arenaReward',
      input: [],
      buttonName: '竞技场奖励'
    }]

    var requestData = {
        data: data
    }
    var htmlContent = template('t_requestTest', requestData)
    $('#mainContent').append(htmlContent)


    $('.exit').click(function(){
      $('#requestTest').remove()
    })
    $(".con2 input").each(function() {
        if ($(this).attr('name')) {
            $(this).before($(this).attr('name'))
        }
    })

    $(".con2 .button").click(function() {
        var route = $(this).prevAll('p').text()
        route = trimLeft(route)
        route = trimRight(route)
        var url = route
        var args = {}
        $(this).parent('div').find("input").each(function() {
            if ($(this).attr('name')) {
                args[$(this).attr('name')] = $(this).val()
            }
        })
        client.request(route, args, function(res) {})
    })
}

//去掉左边的空白
function trimLeft(s) {
    if (s == null) {
        return "";
    }
    var whitespace = new String(" \t\n\r");
    var str = new String(s);
    if (whitespace.indexOf(str.charAt(0)) != -1) {
        var j = 0,
            i = str.length;
        while (j < i && whitespace.indexOf(str.charAt(j)) != -1) {
            j++;
        }
        str = str.substring(j, i);
    }
    return str;
}

//去掉右边的空白
function trimRight(s) {
    if (s == null) return "";
    var whitespace = new String(" \t\n\r");
    var str = new String(s);
    if (whitespace.indexOf(str.charAt(str.length - 1)) != -1) {
        var i = str.length - 1;
        while (i >= 0 && whitespace.indexOf(str.charAt(i)) != -1) {
            i--;
        }
        str = str.substring(0, i + 1);
    }
    return str;
}
